
package leetcode;

public class Code8_ {
    public static void main(String[] args) {
        char[] c = new String("").toCharArray();
        new Code8_().rotateString(c, 3);
        System.out.println(new String(c));
    }

    public void rotateString(char[] str, int offset) {
        if (str.length == 0) {
            return;
        }
        offset = offset % str.length;
        // write your code here
        while (offset > 0) {
            char end = str[str.length - 1];
            for (int a = str.length - 1; a > 0; a--) {
                str[a] = str[a - 1];
            }
            str[0] = end;
            offset--;
        }
    }
}
